home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol E-12 / Vol E-12.iso / games / barbie / barbi001.swf / scripts / frame_1 / DoAction.as
Text File  |  2012-05-21  |  4KB  |  155 lines

  1. function stage1()
  2. {
  3.    _root.ice = 1;
  4.    _root.dir = 4;
  5.    _root.direction();
  6.    _root.prevplace = 22;
  7.    _root.imon = 0;
  8.    with(_root.walls)
  9.    {
  10.       gotoAndStop(1);
  11.    }
  12.    bridge = 0;
  13.    _root.r0 = "1,1,1,1,1,1,1,1,1,1,1";
  14.    _root.r1 = "1,1,1,1,1,1,1,1,1,1,1";
  15.    _root.r2 = "1,1,10,10,10,10,10,10,1,1,1";
  16.    _root.r3 = "1,1,10,10,24,10,10,24,10,10,1";
  17.    _root.r4 = "1,23,21,20,19,22,18,17,10,10,1";
  18.    _root.r5 = "1,1,10,10,10,10,24,16,10,10,1";
  19.    _root.r6 = "1,1,10,24,10,10,10,15,10,24,1";
  20.    _root.r7 = "1,1,10,10,10,12,13,14,10,10,1";
  21.    _root.r8 = "1,1,1,10,10,11,10,24,10,10,1";
  22.    _root.r9 = "1,1,1,10,10,9,10,10,10,10,1";
  23.    _root.r10 = "1,1,1,1,1,1,1,1,1,1,1";
  24.    i = 0;
  25.    while(i < rows)
  26.    {
  27.       var temp = eval("_root.r" + i);
  28.       _root.grid[i] = temp.split(",");
  29.       i++;
  30.    }
  31.    i = 0;
  32.    while(i < rows)
  33.    {
  34.       k = 0;
  35.       while(k < cols)
  36.       {
  37.          _root.grid[i][k] = Number(_root.grid[i][k]);
  38.          k++;
  39.       }
  40.       i++;
  41.    }
  42.    setup(1);
  43.    _root.man.begin();
  44. }
  45. function move()
  46. {
  47.    _root.nextr = _root.oldrows + _root.dirr;
  48.    _root.nextc = _root.oldcols + _root.dirc;
  49.    if(8 < _root.grid[_root.nextr][_root.nextc])
  50.    {
  51.       _root.grid[_root.oldrows][_root.oldcols] = _root.prevplace;
  52.       _root.prevplace = _root.grid[_root.nextr][_root.nextc];
  53.       _root.grid[_root.nextr][_root.nextc] = 9;
  54.       _root.oldrows = _root.nextr;
  55.       _root.oldcols = _root.nextc;
  56.       with(_root.man)
  57.       {
  58.          play();
  59.       }
  60.    }
  61.    else
  62.    {
  63.       trace("wall");
  64.       _root.reset = 0;
  65.    }
  66. }
  67. function setup(num)
  68. {
  69.    startx = 300;
  70.    starty = 150;
  71.    _root.countup = 0;
  72.    i = 0;
  73.    while(i < _root.rows)
  74.    {
  75.       _root.newstartx = _root.startx - i * 30;
  76.       _root.newstarty = _root.starty + i * 15;
  77.       k = 0;
  78.       while(k < _root.cols)
  79.       {
  80.          _root.attachMovie("square" + num,"sq" + _root.countup,_root.countup * 2);
  81.          setProperty(eval("_root.sq" + _root.countup), _X, _root.newstartx + k * 30);
  82.          setProperty(eval("_root.sq" + _root.countup), _Y, _root.newstarty + k * 15);
  83.          whatamic = _root.countup % _root.cols;
  84.          whatamir = Math.floor(_root.countup / _root.rows);
  85.          whatami = _root.grid[whatamir][whatamic];
  86.          with(eval("_root.sq" + _root.countup))
  87.          {
  88.             gotoAndStop(whatami);
  89.          }
  90.          with(_root.walls)
  91.          {
  92.             gotoAndStop(num);
  93.          }
  94.          _root.countup += 1;
  95.          k++;
  96.       }
  97.       i++;
  98.    }
  99.    _root.fadein = 1;
  100. }
  101. function direction()
  102. {
  103.    if(_root.dir == 1)
  104.    {
  105.       _root.dirc = 0;
  106.       _root.dirr = -1;
  107.       _root.reset = 0;
  108.       with(_root.man)
  109.       {
  110.          gotoAndStop("up");
  111.       }
  112.    }
  113.    if(_root.dir == 2)
  114.    {
  115.       _root.dirc = 1;
  116.       _root.dirr = 0;
  117.       _root.reset = 0;
  118.       with(_root.man)
  119.       {
  120.          gotoAndStop("right");
  121.       }
  122.    }
  123.    if(_root.dir == 3)
  124.    {
  125.       _root.dirc = 0;
  126.       _root.dirr = 1;
  127.       _root.reset = 0;
  128.       with(_root.man)
  129.       {
  130.          gotoAndStop("down");
  131.       }
  132.    }
  133.    if(_root.dir == 4)
  134.    {
  135.       _root.dirc = -1;
  136.       _root.dirr = 0;
  137.       _root.reset = 0;
  138.       with(_root.man)
  139.       {
  140.          gotoAndStop("left");
  141.       }
  142.    }
  143. }
  144. grid = new Array();
  145. rows = 11;
  146. cols = 11;
  147. reset = 1;
  148. _root.countup = 0;
  149. _root.startup = 0;
  150. _root.mystage = 1;
  151. _root.fadein = 0;
  152. _root.fadeout = 0;
  153. totalcells = rows * cols;
  154. stop();
  155.